load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

package(default_visibility = ["//rs/ic_os:__subpackages__"])

rust_library(
    name = "device",
    srcs = glob(["src/**/*.rs"]),
    crate_name = "ic_device",
    target_compatible_with = [
        "@platforms//os:linux",
    ],
    deps = [
        # Keep sorted.
        "//rs/ic_os/build_tools/partition_tools",
        "@crate_index//:anyhow",
        "@crate_index//:devicemapper",
        "@crate_index//:gpt",
        "@crate_index//:loopdev_3",
        "@crate_index//:nix",
        "@crate_index//:sys-mount",
        "@crate_index//:tempfile",
        "@crate_index//:tokio",
        "@crate_index//:uuid",
    ],
)

rust_test(
    name = "device_test",
    crate = ":device",
    # This test needs root, so we mark it manual here and expose it in //rs/tests/node:root_tests
    tags = ["manual"],
    target_compatible_with = [
        "@platforms//os:linux",
    ],
    visibility = ["//rs/tests/node:__subpackages__"],
)
